﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Wassrile.Dialogs
{
    public partial class ChSelector : Form
    {
        public string SelectedChannel
        {
            get { return ((string)listBox.Items[listBox.SelectedIndex]).Split(' ')[0]; }
        }
        
        public ChSelector()
        {
            InitializeComponent();
        }

        private void listBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            okBtn.Enabled = listBox.SelectedIndex >= 0;
        }

        private void ChSelector_Load(object sender, EventArgs e)
        {
            foreach(var i in Operation.Web.DataMan.GetChannels())
            {
                listBox.Items.Add(i.Key + " [" + i.Value + "]");
            }
        }
    }
}
